
import axios from "@/utils/request";
// // 请求个人中心的api函数
// export const usersReq = () => {
//     // get会返回一个promise
//     return axios.get('/users/info')
// }
// 请求用户个人信息的api函数
export const usersInfoReq = () => {
    // get会返回一个promise，
    return axios.get('/users/info')
}

// export const editpwdReq = (accPwd) => {
//     return axios.post('/users/editpwd', accPwd)
// }  avatareditReq

export const batchdelReq = (ids) => {
    return axios.get('/users/batchdel', {
        params: {
            ids
        }
    })
}

// 旧密码
export const checkoldpwdReq = (oldPwd) => {
    return axios.get('/users/checkoldpwd', {
        params: {
            oldPwd
        }
    })
}
// 修改密码/users/editpwd
export const editpwdReq = (newPwd) => {
    return axios.post('/users/editpwd', newPwd)
}

// 修改账号/users/edit
export const userseditReq = (form) => {
    return axios.post('/users/edit', form)
}
// 头像/users/avataredit
export const avatareditReq = (imgUrl) => {
    return axios.get('/users/avataredit', {
        params: {
            imgUrl
        }
    })
}

// 商品管理

// 商品列表  /goods/list
export const goodslistReq = (params
    // currentPage, pageSize
) => {
    return axios.get('/goods/list', {
        params
        // : {
        //     currentPage,
        //     pageSize
        // }
    })
}
// 商品分类添加 /goods/categories  usersInfoReq
export const categoriesReq = () => {
    return axios.get('/goods/categories')
}

// 商品添加 /goods/add
export const goodsaddReq = (add) => {
    return axios.post('/goods/add', add)
}

// 修改商品  /goods/edit

export const goodseditReq = (data) => {
    return axios.post('goods/edit', data)
}
// 商品分类  /goods/catelist
export const goodscatelistReq = (params) => {
    return axios.get('goods/catelist', {
        params
    })
}
//修改分类/goods/editcate
export const goodseditcateReq = (data) => {
    return axios.post('/goods/editcate', data)
}

// 添加分类 /goods/addcate
export const goodsaddcateReq = (data) => {
    return axios.post('/goods/addcate', data)
}

// 订单列表查询 /order/list
export const orderlistReq = (params) => {
    return axios.get('/order/list', {
        params
    })
}
//店铺/shop/info
export const shopinfoReq = () => {
    return axios.get('/shop/info')
}
// 店铺修改/shop/edit
export const shopeditReq = (data) => {
    return axios.post('/shop/edit', data)
}
// 店铺上传图片

// 首页 /order/totaldata
export const ordertotaldataReq = () => {
    return axios.get('/order/totaldata')
}
// 订单报表接口/order/ordertotal
export const orderordertotal = (date) => {
    return axios.get('/order/ordertotal', {
        params: {
            date
        }
    })
}